#pragma once
#include "simu_800.h"

#define QL_DATACALL_ERRCODE_BASE        (QL_COMPONENT_NETWORK_MANAGE<<16)

typedef enum
{
    QL_DATACALL_SUCCESS = 0,
    QL_DATACALL_EXECUTE_ERR = 1 | QL_DATACALL_ERRCODE_BASE,
    QL_DATACALL_MEM_ADDR_NULL_ERR,
    QL_DATACALL_INVALID_PARAM_ERR,
    QL_DATACALL_NW_REGISTER_TIMEOUT_ERR,
    QL_DATACALL_CFW_ACT_STATE_GET_ERR = 5 | QL_DATACALL_ERRCODE_BASE,
    QL_DATACALL_REPEAT_ACTIVE_ERR,
    QL_DATACALL_REPEAT_DEACTIVE_ERR,
    QL_DATACALL_CFW_PDP_CTX_SET_ERR,
    QL_DATACALL_CFW_PDP_CTX_GET_ERR,
    QL_DATACALL_CS_CALL_ERR = 10 | QL_DATACALL_ERRCODE_BASE,
    QL_DATACALL_CFW_CFUN_GET_ERR,
    QL_DATACALL_CFUN_DISABLE_ERR,
    QL_DATACALL_NW_STATUS_GET_ERR,
    QL_DATACALL_NOT_REGISTERED_ERR,
    QL_DATACALL_NO_MEM_ERR = 15 | QL_DATACALL_ERRCODE_BASE,
    QL_DATACALL_CFW_ATTACH_STATUS_GET_ERR,
    QL_DATACALL_SEMAPHORE_CREATE_ERR,
    QL_DATACALL_SEMAPHORE_TIMEOUT_ERR,
    QL_DATACALL_CFW_ATTACH_REQUEST_ERR,
    QL_DATACALL_CFW_ACTIVE_REQUEST_ERR = 20 | QL_DATACALL_ERRCODE_BASE,
    QL_DATACALL_ACTIVE_FAIL_ERR,
    QL_DATACALL_CFW_DEACTIVE_REQUEST_ERR,
    QL_DATACALL_NO_DFTPDN_CFG_CONTEXT,
    QL_DATACALL_NO_DFTPDN_INFO_CONTEXT,
}ql_datacall_errcode_e;

#define APN_LEN_MAX                     99
#define USERNAME_LEN_MAX                64
#define PASSWORD_LEN_MAX                64

typedef struct
{
    int ip_version;
    char apn_name[APN_LEN_MAX];
    char username[USERNAME_LEN_MAX];
    char password[PASSWORD_LEN_MAX];
    int auth_type;
}ql_data_call_conf_s;

typedef enum
{
    QL_NW_REG_STATE_NOT_REGISTERED = 0,             //not registered, MT is not currently searching an operator to register to
    QL_NW_REG_STATE_HOME_NETWORK = 1,               //registered, home network
    QL_NW_REG_STATE_TRYING_ATTACH_OR_SEARCHING = 2, //not registered, but MT is currently trying to attach or searching an operator to register to
    QL_NW_REG_STATE_DENIED = 3,                     //registration denied
    QL_NW_REG_STATE_UNKNOWN = 4,                    //unknown
    QL_NW_REG_STATE_ROAMING = 5,                    //registered, roaming
}ql_nw_reg_state_e;

typedef enum
{
    QL_NW_ACCESS_TECH_GSM = 0,
    QL_NW_ACCESS_TECH_GSM_COMPACT = 1,
    QL_NW_ACCESS_TECH_UTRAN = 2,
    QL_NW_ACCESS_TECH_GSM_wEGPRS = 3,
    QL_NW_ACCESS_TECH_UTRAN_wHSDPA = 4,
    QL_NW_ACCESS_TECH_UTRAN_wHSUPA = 5,
    QL_NW_ACCESS_TECH_UTRAN_wHSDPA_HSUPA = 6,
    QL_NW_ACCESS_TECH_E_UTRAN = 7,
}ql_nw_act_type_e;

typedef enum
{
    QL_NW_UE_STAT_NORMAL, /* UE state is normal */
    QL_NW_UE_STAT_DISNET, /* UE cannot register due to restricted areas */
    QL_NW_UE_STAT_CFUN,   /* UE is under cfun0 or cfun4 */
} ql_nw_ue_stat_e;


typedef struct
{
    ql_nw_reg_state_e   state;              //network register state
    int                 lac;                //location area code
    int                 cid;                //cell ID
    ql_nw_act_type_e    act;                //access technology
    ql_nw_ue_stat_e     ue_state;           //ue state
}ql_nw_common_reg_status_info_s;

typedef struct
{
    ql_nw_common_reg_status_info_s   voice_reg;         //voice register info
    ql_nw_common_reg_status_info_s   data_reg;          //data register info
}ql_nw_reg_status_info_s;

typedef ql_data_call_conf_s ql_data_call_default_pdn_cfg_s;
